package io;

import java.io.*;
import java.nio.charset.StandardCharsets;

public class PWDemo {
    public static void main(String[] args) throws IOException {
        PrintWriter pw = new PrintWriter("pw.txt");
        pw.println("哦哦哦。。。");
        pw.println("走一走。。。");
        System.out.println("写出完成");
        pw.close();

        /*FileOutputStream fos = new FileOutputStream("ps.txt");//文件流（低级流）
        OutputStreamWriter osw = new OutputStreamWriter(fos, StandardCharsets.UTF_8);
        BufferedWriter bw = new BufferedWriter(osw);//缓冲字符流（高级流）
        PrintWriter pw = new PrintWriter(bw);
        bw.write("一生何惧几个春秋");
        System.out.println("写出完成");
        bw.close();//先调用flush()冲水*/
    }
}
